Skip to content

aerc: provide default keybindings as baseline for cfg.extraBinds#9030

Open
kfiz wants to merge 1 commit intonix-community:masterfrom
kfiz:push-xpqmxkoqoutn
Open

aerc: provide default keybindings as baseline for cfg.extraBinds#9030
kfiz wants to merge 1 commit intonix-community:masterfrom
kfiz:push-xpqmxkoqoutn

Conversation

@kfiz
Copy link
Copy Markdown
Contributor

@kfiz kfiz commented Apr 3, 2026

Description

Currently setting up additional keybindings in aerc via extraBinds leaves aerc literally unusable as these overwrite the default keybindings. This pr changes this so that keybindings specified in extraBinds extend / overwrite the default keybindings.
cc @teto @khaneliman since both of you looked at the previous aerc pr

Checklist

  • [ x] Change is backwards compatible.

  • [ x] Code formatted with nix fmt or
    nix-shell -p treefmt nixfmt deadnix keep-sorted nixf-diagnose --run treefmt.

  • Code tested through nix run .#tests -- test-all or
    nix-shell --pure tests -A run.all.

  • Test cases updated/added. See example.

  • Commit messages are formatted like

    {component}: {description}
    
    {long description}
    

    See CONTRIBUTING for more information and recent commit messages for examples.

  • If this PR adds a new module

    • Added myself as module maintainer. See example.
    • Generate a news entry. See News
    • Basic tests added. See Tests
  • If this PR adds an exciting new feature or contains a breaking change.

    • Generate a news entry. See News

@github-actions github-actions bot added the mail HM email accounts, thunderbird, alot, notmuch, msmtp, meli... label Apr 3, 2026
@home-manager-ci home-manager-ci bot requested a review from lukasngl April 3, 2026 13:14
Copy link
Copy Markdown
Collaborator

@khaneliman khaneliman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove the random binary file

Currently setting up additional keybindings in aerc via extraBinds leaves aerc literally unusable as these overwrite the default keybindings. This pr changes this so that keybindings specified in extraBinds extend / overwrite the default keybindings.

This would be a pretty big breaking change for users of the module that have configured their own keybinds with the expectation of the current behavior.. But, I do agree it makes sense that extra is additional instead of replace. how does aerc resolve the config? Will

@kfiz kfiz force-pushed the push-xpqmxkoqoutn branch from fb7d59b to 69d9fc1 Compare April 4, 2026 05:12
@kfiz
Copy link
Copy Markdown
Contributor Author

kfiz commented Apr 4, 2026

remove the random binary file

Currently setting up additional keybindings in aerc via extraBinds leaves aerc literally unusable as these overwrite the default keybindings. This pr changes this so that keybindings specified in extraBinds extend / overwrite the default keybindings.

This would be a pretty big breaking change for users of the module that have configured their own keybinds with the expectation of the current behavior.. But, I do agree it makes sense that extra is additional instead of replace.

I agree. To keep the current behaviour for these users the only option I can currently think of is to add an additional setting with an appropriate name for the use case I'm targeting here. Something called e.g. additionalBinds ...

how does aerc resolve the config?

aerc checks whether this config is present and if it can't find it it copies it into $XDG_CONFIG_HOME/aerc.

Edit: For users depending on the current behaviour any keybindings that were previously specified via this setting should still hold, since in case of duplicate keybindings the latter prevail, see https://aerc-docs.com/reference/aerc-binds.5/. So the only effect they might see is that there are some new keybindings that they hadn't configured before (... and that they are thus not using?) ...

@kfiz
Copy link
Copy Markdown
Contributor Author

kfiz commented Apr 5, 2026

Edit: For users depending on the current behaviour any keybindings that were previously specified via this setting should still hold, since in case of duplicate keybindings the latter prevail, see https://aerc-docs.com/reference/aerc-binds.5/. So the only effect they might see is that there are some new keybindings that they hadn't configured before (... and that they are thus not using?) ...

@khaneliman What do you think? Might not be a breaking change at all.

@kfiz kfiz force-pushed the push-xpqmxkoqoutn branch from 69d9fc1 to b5f5a19 Compare April 10, 2026 17:57
@khaneliman
Copy link
Copy Markdown
Collaborator

aerc checks whether this config is present and if it can't find it it copies it into $XDG_CONFIG_HOME/aerc.

Ugh... I hate that kind of config handling.

I'm definitely not a fan of just copy pasting the current defaults in and having to maintain that here... I'm always thinking about what the solution will look like months down the line when someone complains that upstream defaults aren't being respected.

Looking at the docs upstream, it seems like there isn't much flexibility in their config system.

@kfiz
Copy link
Copy Markdown
Contributor Author

kfiz commented Apr 11, 2026

aerc checks whether this config is present and if it can't find it it copies it into $XDG_CONFIG_HOME/aerc.

Ugh... I hate that kind of config handling.

I'm definitely not a fan of just copy pasting the current defaults in and having to maintain that here... I'm always thinking about what the solution will look like months down the line when someone complains that upstream defaults aren't being respected.

Looking at the docs upstream, it seems like there isn't much flexibility in their config system.

I understand and I'm happy to go back to just using readFile, but I tend to avoid IFD as much as I can these days.

@teto
Copy link
Copy Markdown
Collaborator

teto commented Apr 11, 2026

I'm definitely not a fan of just copy pasting the current defaults in and having to maintain that here... I'm always thinking about what the solution will look like months down the line when someone complains that upstream defaults aren't being respected.

agreed. From the manpage it's not obvious one has to redefine all mappings ? Cant we define just a few https://man.archlinux.org/man/aerc-binds.5.en and aerc merge them ?

@kfiz
Copy link
Copy Markdown
Contributor Author

kfiz commented Apr 11, 2026

agreed. From the manpage it's not obvious one has to redefine all mappings ? Cant we define just a few https://man.archlinux.org/man/aerc-binds.5.en and aerc merge them ?

Not sure I follow ... . So currently if a user wants to add new/additional keybindings via extraBinds these will be the only ones used by aerc as the module will just create a new binds.conf that holds the new/additional keybindings and only these. My suggestion here is to merge new/additional keybindings with the default keybindings provided by upstream.

Non-nix users would just add their new/additional keybindings to the default binds.conf that will be present in XDG-CONFIG-HOME/aerc.

@teto
Copy link
Copy Markdown
Collaborator

teto commented Apr 12, 2026

sry I dont know aerc and I might have missed some previous explanation but typically programs have a set of builtins and binds.conf would be merged. Seems like aerc just starts with 0 bindings if binds.conf exists, forcing you to re-create every binding. Is this correct ?

@kfiz
Copy link
Copy Markdown
Contributor Author

kfiz commented Apr 12, 2026

sry I dont know aerc and I might have missed some previous explanation but typically programs have a set of builtins and binds.conf would be merged. Seems like aerc just starts with 0 bindings if binds.conf exists, forcing you to re-create every binding. Is this correct ?

No worries. No, aerc reads all bindings from binds.conf. If it is not present at startup it is copied into $XDG_CONFIG_HOME/aerc at startup:

The binds.conf file is used for configuring keybindings used in the aerc interactive client.
It is expected to be in your XDG config home plus aerc, which defaults to ~/.config/aerc/binds.conf.
If the file does not exist, the built-in default will be installed. An alternate file can be specified
via the —binds-conf command line argument, see aerc(1).

see https://aerc-docs.com/reference/aerc-binds.5/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mail HM email accounts, thunderbird, alot, notmuch, msmtp, meli...

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants